import { BroadCastCall } from "../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../Framework/MQ/MessageBlock";
import { SLookupPlayerRequest } from "../../../../Message/Game/SLookupPlayerRequest";
import { Cache } from "../../cache/Cache";
import { ThingUtil } from "../../scene/layer/utils/ThingUtil";
import { ESex } from "../../../../Message/Public/ESex";
import { Language } from "../../../../extend/language/Language";
import { MsgManager } from "../../manager/MsgManager";
//class LookupPlayerCommand
    
    export  class LookupPlayerCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            var loc5=null;
            var loc6=null;
            var loc7=NaN;
            var loc1=arg1.messageBase as SLookupPlayerRequest;
            var loc2=loc1.fromPlayer.name;
            var loc3=loc1.fromPlayer.sex;
            var loc4=Cache.instance.role.playerInfo.sex;
            if (ThingUtil.entityUtil.getEntity(loc1.fromEntityId) != null) 
            {
                if (loc3 == ESex._ESexMan && loc4 == ESex._ESexWoman) 
                {
                    loc5 = loc2 + Language.getString(30191);
                }
                else if (loc3 == ESex._ESexWoman && loc4 == ESex._ESexMan) 
                {
                    loc5 = loc2 + Language.getString(30192);
                }
                else if (loc3 == ESex._ESexWoman && loc4 == ESex._ESexWoman || loc3 == ESex._ESexMan && loc4 == ESex._ESexMan) 
                {
                    (loc6 = new Array<any>()).push(loc2 + Language.getString(30193));
                    loc6.push(loc2 + Language.getString(30194));
                    if ((loc7 = Math.random()) < 0.5) 
                    {
                        loc5 = loc6[0];
                    }
                    else 
                    {
                        loc5 = loc6[1];
                    }
                }
                MsgManager.addTipText(loc5);
                MsgManager.showRollTipsMsg(loc5);
            }
            return;
        }
    }
